<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<s:action name="header" executeResult="true">
	<s:param name="titles">Thêm danh mục</s:param>
</s:action>

<s:action name="managesidebar" executeResult="true" />

<!-- Center -->
<div id="center_column_des" class="center_column">

<div class="breadcrumb">
	<a href="<s:url action="index"></s:url>">Trang chủ</a><span class="navigation-pipe">&gt;</span><span class="navigation_page">Thêm danh mục</span>
</div>

<!-- /Breadcrumb -->
	<form action="<s:url action="addcategory"></s:url>" method="post" class="std" enctype="multipart/form-data" name="addS" id="addS">
		<fieldset>
			<h3>Thêm danh mục</h3>
			<table class="form">
				<tr>
					<td>Tiêu đề :</td>
					<td><input type="text" name="title" id="title" maxlength="50" value="" style="width:550px;"/></td>
				</tr>				
				<tr>
					<td style="vertical-align:middle;">Danh mục cha :</td>
					<td>
						<select name="parent_id" id="parent_id">
							<option value="0">Không có</option>
							<s:iterator value="categoryParentList" var="parent">
								<option value="<s:property value="#parent.category_id"/>"><s:property value="#parent.title"/></option>
							</s:iterator>
						</select>
					</td>
				</tr>
				<tr>
					<td style="vertical-align:middle;">Hiển thị :</td>
					<td>
						<select name="enabled" id="enabled">
							<option value="1">Hiện</option>
							<option value="0">Ẩn</option>
						</select>
					</td>
				</tr>
			</table>
			<p class="submit" style="padding:10px 0 0 250px;">
				<input type="submit" name="submitCategory" id="submitCategory"
					value="Lưu" class="button_large">
			</p>
		</fieldset>
		<s:hidden id="saction" name="saction" value="process"></s:hidden>
	</form>
	<!-- /MODULE contact -->
<script type="text/javascript">
$().ready(function() {
	$('#submitCategory').click(function() { 		 
        $(".error").remove();
        var hasError = false;

        var titleVal = $("#title").val();
        

        if($.trim(titleVal) == '') {
            $("#title").after('<span style="margin-left: 5px;margin-top: 5px;color: #CC0000;" class="error">Vui lòng nhập tiêu đề.</span>');
            hasError = true;
        }    
        
        if(hasError == true) { return false; }

    }); 
});

</script>	
</div>

<s:action name="footer" executeResult="true" />